		<form enctype='multipart/form-data' action='<?php echo $_SERVER["PHP_SELF"]?>' method='post'>
			<p>
				<label>Заглавие: </label>
				<input type='text' name='title'/>
			</p>
			<p>
				<label>Автор: </label>
				<input type='text' name='author'/>
			</p>
			<p>
				<label>Описание: </label>
			</p>
			<p>
				<textarea name='description' rows="4" cols="50"></textarea>
			</p>
			<p>
				<label>Език: </label>
				<input type='text' name='language'/>
			</p>
			<p>
				<input type='hidden' name='MAX_FILE_SIZE' value='100000' />
				<label for='cover'>Избери корица: </label>
				<input type='file' name='cover' id='cover'/>
			</p>
			<p>
				<input type='hidden' name='MAX_FILE_SIZE' value='100000' />
				<label for='strfile'>Избери книга: </label>
				<input type='file' name='strfile' id='strfile'/>
			</p>
			<p>
				<input type='submit' name='submit' value=' Качи ! '/>
			</p>	
		</form>
		<?php 
			//autoload function 
//			function __autoload($class_name){
//				require_once "classes/".$class_name.".php";
//			}
			//upload file function
			function uploadFile($real,$file){
				if (is_uploaded_file($file)){
					if (move_uploaded_file($file, "upload/covers/$real"))
						echo "<p>File uploaded successfully</p>";
					else
						echo "<p><b>Error:</b> File not moved successfully!</p>";
				}
				else
					echo "<p><b>Error:</b> The file is not uploaded!</p>";
			}
			
			if(isset($_POST["submit"])){
				$conect= new DBconect();
							
				//upload book cover
				$realcover=$_FILES['cover']['name'];
				$filecover = $_FILES['cover']['tmp_name'];
				uploadFile($realcover,$filecover);
	
				//upload book file
				$realname=$_FILES['strfile']['name'];
				$filename = $_FILES['strfile']['tmp_name'];
				uploadFile($realname,$filename);
					
				$coverpath='upload/covers/'.$realcover;
	
				$book=new Books($_POST['title'],$_POST['description'],$_POST['language'],$coverpath);
				$bookpath=new Path('upload/books/'.$realname);
				$author=new Authors($_POST['author']);
				
				$conect->addBook($book);
				$conect->addPath($bookpath);
				$conect->addAuthor($author);
				$conect->addBookAuthorConect($book,$author);
				$conect->addBookPathConect($book,$bookpath);
			
			}
		?>
